// 基于template/src/widgets/{{appEntities}}/{{ctrls@GRID}}-grid/{{spinalCase ctrl.codeName}}-grid-model.ts.hbs生成
import { IGridModel, IParam, isEmpty, VerifyUtil } from '@/core';

function getModel(): IGridModel {
	return {
		cssName: '',
		aggMode: 'NONE',
		caption: '',
		controlType: 'GRID',
		codeName: 'Main',
		columns: getGridColumns(),
		dataItems: getGridDataItems(),
		dataExport: getDataExport(),
		enableRowEdit: false,
		entityCodeName: 'Sys_department',
		entityLogicName: '部门',
		createDefaultItems: getCreateDefaultItems(),
		updateDefaultItems: getUpdateDefaultItems(),
		name: 'grid',
		noSort: false,
		rules: {
			//	静态值规则
			staticRules: {},
			//	编辑项值规则
			editRules: [],
		},
		showHeader: true,
		sortDir: '',
		sortField: '',
		limit: 20,
		dataImport: {
			codeName: 'DataImport',
			ignoreError: false,
			importItems: [
				{
					name: 'department_name',
					caption: App.ts('', '部门名称'),
					fieldCodeName: 'department_name',
				},
				{
					name: 'department_number',
					caption: App.ts('', '部门编号'),
					fieldCodeName: 'department_number',
				},
				{
					name: 'parent_id',
					caption: App.ts('', '上级部门'),
					codeListTag: 'ad__Sys_all_organizational_unit',
					fieldCodeName: 'parent_id',
				},
				{
					name: 'organization_id',
					caption: App.ts('', '组织机构'),
					codeListTag: 'ad__Sys_all_organization',
					fieldCodeName: 'organization_id',
				},
				{
					name: 'short_name',
					caption: App.ts('', '简称'),
					fieldCodeName: 'short_name',
				},
				{
					name: 'description',
					caption: App.ts('', '备注'),
					fieldCodeName: 'description',
				},
				{
					name: 'sort',
					caption: App.ts('', '排序'),
					fieldCodeName: 'sort',
				},
				{
					name: 'id',
					caption: App.ts('', '主键标识(不填则自动生成)'),
					fieldCodeName: 'id',
				},
			],
		},
		paging: {
			defaultPageSize: 20,
		},
		uiEngineModel: [
			{
				name: 'engine_grid',
				triggerType: 'CTRLEVENT',
				logicType: 'APPVIEWENGINE',
				eventNames: 'ROWDBLCLICK;SELECTIONCHANGE;LOAD;BEFORELOAD',
				scriptCode: ``,
				entityCodeName: '',
				logicName: ``,
			},
		],
	};
}
//  获取所有表格列模型
function getGridColumns(): IParam[] {
	return [];
}

//  获取所有表格数据项
function getGridDataItems() {
	return [
		{
			name: 'srfkey',
			codeName: '',
			customCode: false,
			fieldCodeName: 'id',
			fieldName: 'id',
			valueFormat: '',
			dataType: '25',
		},
		{
			name: 'srfdataaccaction',
			codeName: '',
			customCode: false,
			fieldCodeName: 'id',
			fieldName: 'id',
			valueFormat: '',
			dataType: '25',
		},
		{
			name: 'organization_id',
			codeName: '',
			customCode: false,
			fieldCodeName: 'organization_id',
			fieldName: 'organization_id',
			valueFormat: '',
			dataType: '25',
		},
		{
			name: 'parent_id',
			codeName: '',
			customCode: false,
			fieldCodeName: 'parent_id',
			fieldName: 'parent_id',
			valueFormat: '',
			dataType: '25',
		},
		{
			name: 'srfmajortext',
			codeName: '',
			customCode: false,
			fieldCodeName: 'department_name',
			fieldName: 'department_name',
			valueFormat: '',
			dataType: '25',
		},
	];
}

function getDataExport() {
	return {
		default: true,
		codeName: 'default',
		enableFront: true,
		fileName: '部门',
		exportItems: [],
	};
}

function getCreateDefaultItems() {
	return [];
}

function getUpdateDefaultItems() {
	return [];
}

export const model = getModel();
